import {DataTableColumns, NImage, NSpace, NSwitch, NTag} from "naive-ui";
import {useColumns} from "@/views/pages/system/user/useColumns";
import {setting} from "@/config/setting";
import {h} from "vue";
import {eventBus} from "@/config/eventBus";

const {logo} = setting

const {
} = useColumns()

/**
 * 状态的点击事件
 * @param row
 */
const handleSwitchClick = (row: any) => {
    eventBus.emit("handleUserStatusSwitchClick", row)
}

export const columns: DataTableColumns<any> = [
    {
        title: "标题",
        key: "title",
        width: 150
    },
    {
        title: "消息类型",
        key: "type",
        width: 100,
        render: (row) => {
            var messageType = '用户消息'
            if(row.type == 0){
                return h(NTag, {type:'info'}, () => '系统消息')
            }else {
                return h(NTag, {type:'primary'}, () => '用户消息')
            }

        }
    },
    {
        title: "状态",
        key: "status",
        width: 100,
        render: (row) => {
            if(row.status=='0'){
                return h(NTag, {type:'info'}, () => '未读')
            }else {
                return h(NTag, {type:'primary'}, () => '已读')
            }
        }
    },
    {
        title: "内容",
        key: "content",
        width: 300,
        ellipsis: {
            tooltip: true
        }
    },

    {
        title: "发送时间",
        key: "createTime",
        width: 200
    }
]